Population class extension: return functions module
Main script to provide the return functions class extension.
This consists of the following class methods: - return_population_settings - return_binary_c_defaults - return_all_info - export_all_info
- class binarycpython.utils.population_extensions.return_functions.return_functions(**kwargs)[source]
Bases:
object
Extension for the Population class containing the code for return function
- export_all_info(use_datadir=True, outfile=None, include_population_settings=True, include_binary_c_defaults=True, include_binary_c_version_info=True, include_binary_c_help_all=True, ensure_ascii=False, indent=4)[source]
Function that exports the all_info to a JSON file
- Tasks:
TODO: Fix to write things to the directory. which options do which etc
TODO: there’s flawed logic here. rewrite this part pls
- TODO: consider actually just removing the whole ‘output to file’ part and let the
user do this.
- Parameters
include_population_settings (
bool
) – whether to include the population_settings (see function return_population_settings)include_binary_c_defaults (
bool
) – whether to include a dict containing the binary_c parameters and their default valuesinclude_binary_c_version_info (
bool
) – whether to include a dict containing all the binary_c version info (see return_binary_c_version_info)include_binary_c_help_all (
bool
) – whether to include a dict containing all the information about the binary_c parameters (see get_help_all)use_datadir (
bool
) – Boolean whether to use the custom_options[‘data_dir’] to write the file to. If the custom_options[“base_filename”] is set, the output file will be called <custom_options[“base_filename”]>_settings.json. Otherwise a file called simulation_<date+time>_settings.json will be createdoutfile (
Optional
[str
]) – if use_datadir is false, a custom filename will be usedensure_ascii (
str
) – the ensure_ascii flag passed to json.dump and/or json.dumps (Default: False)indent (
int
) – indentation passed to json.dump and/or json.dumps (default 4)
- Return type
Optional
[str
]
- return_all_info(include_population_settings=True, include_binary_c_defaults=True, include_binary_c_version_info=True, include_binary_c_help_all=True)[source]
Function that returns all the information about the population and binary_c
- Parameters
include_population_settings (
bool
) – whether to include the population_settings (see function return_population_settings)include_binary_c_defaults (
bool
) – whether to include a dict containing the binary_c parameters and their default valuesinclude_binary_c_version_info (
bool
) – whether to include a dict containing all the binary_c version info (see return_binary_c_version_info)include_binary_c_help_all (
bool
) – whether to include a dict containing all the information about the binary_c parameters (see get_help_all)
- Return type
dict
- Returns
dictionary containing all, or part of, the above dictionaries